package com.sl.au.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.InvoiceDetailInfoView;

public interface InvoiceDetailInfoViewRepository  extends JpaRepository<InvoiceDetailInfoView, String> {

	@Query("select p from InvoiceDetailInfoView p where p.sContractId = ?1 and p.sContractType=?2 and p.sCreateUserId=?3 ")
	Page<InvoiceDetailInfoView> getInvoiceDetailInfoHistory(String contractId, String contractType, String userId,
			Pageable pageable);

	@Query("select count(*) from InvoiceDetailInfoView p where p.sContractId = ?1 and p.sContractType=?2 and p.sCreateUserId=?3 ")
	Long getInvoiceDetailInfoHistoryCount(String contractId, String contractType, String userId);

	@Query("select p from InvoiceDetailInfoView p where p.sContractId = ?1 and p.sContractType=?2 ")
	Page<InvoiceDetailInfoView> getInvoiceDetailInfoAllHistory(String contractId, String contractType,
			Pageable pageable);

	@Query("select count(*) from InvoiceDetailInfoView p where p.sContractId = ?1 and p.sContractType=?2 ")
	Long getInvoiceDetailInfoAllHistory(String contractId, String contractType);

}
